﻿<%@ WebHandler Language="C#" Class="GetList" %>

using System;
using System.Web;

public class GetList : IHttpHandler
{
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "application/json";

        int n = string.IsNullOrEmpty(context.Request.QueryString["n"]) ? 10 : int.Parse(context.Request.QueryString["n"]);
        System.Data.DataSet ds = App_Code.PublicHelper.DataProductHelper.QueryTopN(n);
        string json = Newtonsoft.Json.JsonConvert.SerializeObject(ds.Tables[0], Newtonsoft.Json.Formatting.Indented);
        context.Response.Write(json);
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }
}